package Demo1;

/**
 * Description:
 * Date: 2025-10-11
 * Time: 13:39
 */
//如果一个类不想被其它类继承，可以使用关键字final修饰当前这个类。此时这个类叫做密封类
public /*final*/ class Animal {
    public String name;
    public int age;

    public Animal() {
        System.out.println("父类的构造方法...");
    }

    static {
        System.out.println("父类的静态代码块...");
    }

    {
        System.out.println("父类的实例代码块...");
    }

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void eat() {
        System.out.println(this.name + "正在吃饭");
    }

    ////////////////////////////////

    int c = 30;
    int a = 1;
    int b = 2;

    public void testA() {
        System.out.println("父类的testA()...");
    }
}
